Pre-Requisite
Within this tutorial we will deploy a Minecraft server, configure backups and a monitoring dashboard with a single compose file. You will need the following:- A copy of our Docker compose template
- A VPS / Dedicated host with sudo / root access
- A working Docker deployment
Installing Docker
We have already covered how to deploy Docker to a VPS within our lab series, you should follow this guide if you have not got a working instance. Other great resources for this exist within the DigitalOcean Community forum.Deployment
For the sake of simplicity this tutorial will be entirely from the linux command line however it should work without any issues in platforms such as Portainer, if you haven’t already SSH into your server. The first step is to download a copy of our compose.yml file, you can fetch a copy using the following cURL command.nano or vi you can edit the contents of the file and make changes as required
"25565:25565".
- Editing these values will change what ports are exposed on your local machine. You only normally need to change this if you’re running multiple Minecraft servers e.g. Bungeecord.
MEMORY: 4G.
- Setting this value to something between 4G and 12G tend to offer the best results, the avg server shouldn’t need more than 8G assigned.
TYPE: PURPUR.
- This defines the jar file used to host your Minecraft server, two of the most common types are
PAPERandPURPURbut there are multiple other values that can be assigned her based on the type of server you wish to run.
"8180:8080".
- It’s only recommended you change the left hand value for this service if you’re currently using it for an alternative solution. You should take note of these port changes as you may need to reference them later on.
"80:3000".
- It’s only recommended you change the left hand value for this service if you’re currently using it for an alternative solution. You should take note of these port changes as you may need to reference them later on.
BACKUP_INTERVAL: "1d".
- Define how frequently your server is backed up, for a small server 1d is more than enough but for larger public environments you may wish to move this to every 4 hours.
docker ps command.
If one or more services produces an error, you should try using the below command to ensure nothing is currently running on the specified port.
Importing Worlds
Ensure your docker instance is stopped before you change the world file to prevent corruptions. :::info If you do not have a Minecraft world you would like to bring over you can skip this step ::: Firstly navigate to where your world is stored, if you’re world is in a singleplayer state this will be located in your.minecraft\saves folder.
- You should compress your world utilising a
zipfolder, the steps will vary slightly based on OS - Start a SFTP shell using
sftp username@server-ip - Navigate to
/svr/minecraftusingcd /svr/minecraft - Upload the file by using
put /path/to/folder/world.zip /svr/minecraft/world.zip- This may take a few minutes depending on your internet upload speeds
- Exit the SFTP session using
exit - Start an SSH sessions using
ssh username@server-ip - Install the
unzippackage usingsudo apt install unzip - Unzip the world we just uploaded using
unzip /svr/minecraft/world.zip
Monitoring
This section is optional however as our docker-compose file already contains the required info to configure this we will do so in this guide. If you do not care for monitoring this can be ignored.Prometheus
Prometheus is very similar tool to InfluxDB (a tool we use in our lab series) and it is used for metric collection for a given source. Everything within our docker instance should already be configured as required you only need to ensureprometheus is running when you use the docker ps command.